home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 6: Level 6 / 17 Bit - Level 6 (1998)(Epic Marketing)[!].iso / quartz / q0429.dms / q0429.adf / libray / libcommon / xform.c < prev    next >
C/C++ Source or Header  |  1992-05-20  |  2KB  |  77 lines

  1. /*
  2.  * xform.c
  3.  *
  4.  * Copyright (C) 1989, 1991, Craig E. Kolb
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  * 
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  * $Id: xform.c,v 4.0.1.1 91/10/04 15:51:53 cek Exp Locker: cek $
  17.  *
  18.  * $Log:    xform.c,v $
  19.  * Revision 4.0.1.1  91/10/04  15:51:53  cek
  20.  * patch1: Initial revision.
  21.  * 
  22.  * Revision 4.0  1991/09/29  15:34:31  cek
  23.  * Initial version.
  24.  *
  25.  */
  26. #include "common.h"
  27. #include "xform.h"
  28.  
  29. TransMethods *iXformMethods;
  30.  
  31. /*
  32.  * Create and return reference to an Xform structure.
  33.  * In this case, we return a NULL pointer, as the Xform
  34.  * structure does not hold any data.
  35.  */
  36. Xform *
  37. XformCreate()
  38. {
  39.     return (Xform *)NULL;
  40. }
  41.  
  42. /*
  43.  * Return a pointer to collection of methods for the
  44.  * Xform transformation.
  45.  */
  46. TransMethods *
  47. XformMethods()
  48. {
  49.     if (iXformMethods == (TransMethods *)NULL) {
  50.         iXformMethods = (TransMethods *)Malloc(sizeof(TransMethods));
  51.         iXformMethods->create = (TransCreateFunc *)XformCreate;
  52.         iXformMethods->propagate = XformPropagate;
  53.     }
  54.     return iXformMethods;    
  55. }
  56.  
  57. /*
  58.  * Given an Xform structure and forward and inverse transformations,
  59.  * propagate the information in the Xform structure to the
  60.  * transformations.
  61.  * In this case, the information "in" the Xform structure is
  62.  * actually stored in the forward transformation; the Xform
  63.  * points to NULL.
  64.  */
  65. void
  66. XformPropagate(xform, trans, itrans)
  67. Xform *xform;
  68. RSMatrix *trans, *itrans;
  69. {
  70.     /*
  71.      * The Xform methods change the forward trans
  72.      * directly, so it's already all set.
  73.      * Build the inverse...
  74.      */
  75.     MatrixInvert(trans, itrans);
  76. }
  77.